<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../jquery-3.1.1.js"></script>
</head>

<body>

    <div id="wrap">
        <ul id="tab">
            <li>a</li>
            <li>b</li>
            <li>c</li>
        </ul>
        <div id="main">
            <div>a页面</div>
            <div>b页面</div>
            <div>c页面</div>
        </div>
    </div>

    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        #wrap {
            width: 300px;
            height: 200px;
            border: 1px solid red;
        }

        #tab {
            width: 300px;
            overflow: hidden;
        }

        #tab li {
            list-style: none;
            float: left;
            border: 1px solid blue;
            box-sizing: border-box;
            width: 100px;
            height: 30px;
            text-align: center;
            line-height: 30px;
        }

        #main>div {
            width: 300px;
            height: 170px;
            text-align: center;
            line-height: 170px;
            font-size: 30px;
            display: none;
        }
        #main div:first-child{
            display: block;
        }
    </style>


</body>
<script>
    $(function () {
        let lis = $('ul li');
        let divs = $('#main>div')
        for (let i = 0; i < lis.length; i++) {
            lis[i].onclick = function(){
                for (let l = 0; l < divs.length; l++) {
                    divs[l].style.display = 'none';
                }
                divs[i].style.display = 'block'
            }
        }
        // console.log(lis)
    })
</script>

</html>